// -----------------------------
// Author: 		Dhaenens Gert	
// Creation: 	2/12/2015 10:46:27 PM				
// -----------------------------

#include "CPlatform.h"

namespace Flow
{

	CPlatform::CPlatform()
	{
	}

	CPlatform::~CPlatform()
	{
	}

	void CPlatform::Release()
	{
		delete this;
	}

	void CPlatform::Sleep(UInt32 milliseconds)
	{
		::Sleep((DWORD)milliseconds);
	}

	Platform::Enum CPlatform::GetPlatform() const
	{
		#ifdef _WIN64
		return Platform::Win64;
		#else
		return Platform::Win32;
		#endif
	}
	Bool CPlatform::IsPlatform(Platform::Enum platform) const
	{
		return (GetPlatform() == platform);
	}

	UInt32 CPlatform::GetProcessorCount() const
	{
		SYSTEM_INFO sysInfo = {};
		GetSystemInfo(&sysInfo);

		return (UInt32)sysInfo.dwNumberOfProcessors;
	}

	tstring CPlatform::GetRootFolder() const
	{
		const Size_T bufferLen = MAX_PATH;
		TChar buffer[bufferLen];

		_tgetcwd(buffer, bufferLen);

		return tstring(buffer);
	}

	UInt32 CPlatform::GetCurrentThreadID() const
	{
		return (UInt32) ::GetCurrentThreadId();
	}
}